Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If a class's type parameters split, force the clauses to split too. #1511

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

munificent
Copy link
Member

I think it looks weird if the extends, etc. clauses hang immediately after the > when the type parameters split.

Since import/export directives use the same piece, this nominally affects them too but in practice it's extremely rare for there to be a newline in an import before any other clauses.

While I was at it, I cleaned up the way we build a piece tree for directives. That's some of the oldest code in the new formatter and was more complex than it needed to be. There was no need to use both an InfixPiece and a ClausesPiece since they do basically the same thing.

I think it looks weird if the `extends`, etc. clauses hang immediately after the `>` when the type parameters split.

Since import/export directives use the same piece, this nominally affects them too but in practice it's extremely rare for there to be a newline in an import before any other clauses.

While I was at it, I cleaned up the way we build a piece tree for directives. That's some of the oldest code in the new formatter and was more complex than it needed to be. There was no need to use both an InfixPiece and a ClausesPiece since they do basically the same thing.
@munificent munificent merged commit 2695039 into main Aug 2, 2024
7 checks passed
@munificent munificent deleted the split-clauses branch August 2, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants